<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
var tongji = function (string) {
    let map = new Map()
    for( var i=0 ; i<string.length ; i++ ){
        let count = map.get(string[i]) || 0
        map.set(string[i],count+1)
    }

    return map
}

var string = 'aaabbcdefc'
console.log(tongji(string))
    </script>
</body>
</html>